import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import pluginVue from 'eslint-plugin-vue';

export default [
    { files: ['src/**/*.{mjs,cjs,ts,vue}'] },
    {
        ignores: [
            'dist/*',
            'src/types/*',
            'src/components/TpCustomFilePicker/chooseAndUploadFile.js',
            'src/components/TpCustomFilePicker/index.vue',
            'src/components/TpCustomFilePicker/uploadImage.vue',
            'src/components/TpUploadImage/index.vue',
            'src/lib/amap-wx.js'
        ]
    },
    pluginJs.configs.recommended,
    ...tseslint.configs.recommended,
    ...pluginVue.configs['flat/essential'],
    {
        languageOptions: {
            globals: {
                ...globals.browser,
                ...globals.commonjs,
                ...globals.es2021,
                uni: true,
                UniApp: true,
                getCurrentPages: true,
                requirePlugin: true
            },
            parserOptions: {
                ecmaVersion: 'latest',
                sourceType: 'module',
                parser: '@typescript-eslint/parser'
            }
        }
    },
    {
        rules: {
            // 关闭组件名称必须为多词的校验
            'vue/multi-word-component-names': 'off',
            //
            '@typescript-eslint/no-explicit-any': ['off'],
            //
            '@typescript-eslint/no-unused-vars': 'off',
            //
            'no-undef': 'off'
        }
    }
];
